package com.example.eos.bean;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.eos.tool.GlobalParam;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 收藏信息
 */
public class Collec {

    private String collecid;

    @NotNull(message = "用户id不能为空")
    @Length(min = 32,max = 32, message = "用户id格式错误")
    private String userid;

    @NotNull(message = "作品id不能为空")
    @Length(min = 32,max = 32, message = "作品id格式错误")
    private String publishid;

    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date creattime;

    public Collec(){}

    public Collec(Collec collec){
        this.collecid = GlobalParam.getUUID();
        this.userid = collec.userid;
        this.publishid = collec.publishid;
        this.creattime = GlobalParam.getTime();
    }

    @Override
    public String toString() {
        return "Collec{" +
                "collecid='" + collecid + '\'' +
                ", userid='" + userid + '\'' +
                ", publishid='" + publishid + '\'' +
                ", creattime=" + creattime +
                '}';
    }

    public String getCollecid() {
        return collecid;
    }

    public void setCollecid(String collecid) {
        this.collecid = collecid == null ? null : collecid.trim();
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid == null ? null : userid.trim();
    }

    public String getPublishid() {
        return publishid;
    }

    public void setPublishid(String publishid) {
        this.publishid = publishid == null ? null : publishid.trim();
    }

    public Date getCreattime() {
        return creattime;
    }

    public void setCreattime(Date creattime) {
        this.creattime = creattime;
    }
}
